package util;

import java.util.*;

import exception.AttributeAlreadyDeclaredException;
import exception.MethodAlreadyDeclaredException;

import util.Attribute;

public class Class {
	private Map<String, Attribute> attributes;
	private Map<String, Method> methods;
	private String name;

	public String getName() {
		return name;
	}

	public Class() {
	}

	public Class(Map<String, Attribute> attributes) {
		this.attributes = attributes;
	}

	public Class(String name, Map<String, Attribute> attributes, Map<String, Method> methods) {
		this.name = name;
		this.attributes = attributes;
		this.methods = methods;
	}
	
	public void addAttribute(Attribute attribute) throws AttributeAlreadyDeclaredException {
		attributes.put(attribute.getName(), attribute);
	}
	
	public void addMethod(Method method) throws MethodAlreadyDeclaredException {
		methods.put(method.getMethodName(), method);
	}
	
	// TODO do usuniecia po zakonczeniu tworzenia
	public Map<String, Attribute> getAttributes() {
		return attributes;
	}

	public Map<String, Method> getMethods() {
		return methods;
	}
}
